package com.longxi.tianjintianbao.ui.activity.patrol;

import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.widget.Button;
import android.widget.TextView;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.presenter.patrol.PatrolConnectionAtPresenter;
import com.longxi.tianjintianbao.ui.view.patrol.IPatrolConnectionAtView;

import butterknife.BindView;

/**
 * Created by 70339 on 2018/5/10.
 * 代码无八阿哥
 * 阿弥陀佛
 */
public class PatrolConnectionActivity extends BaseActivity<IPatrolConnectionAtView, PatrolConnectionAtPresenter> implements IPatrolConnectionAtView {
    @BindView(R.id.tvTip)
    TextView mTvTip;
    @BindView(R.id.btnNoPatrolCode)
    Button mBtnNoPatrolCode;

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_patrol_connection;
    }

    @Override
    public void initData() {
        super.initData();
        setTitle("设备连接");
        setTvLeft("返回");
        SpannableString span = new SpannableString("提示:连接设备时请将手机靠近设备");
        span.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.colorAccent)), 0, 3,
                Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
//        提示:连接设备时请将手机靠近设备
        mTvTip.setText(span);
    }

    @Override
    public void initListener() {
        super.initListener();
        mBtnNoPatrolCode.setOnClickListener(v -> jumpToActivity(PatrolDetailActivity.class));
    }

    @Override
    protected PatrolConnectionAtPresenter createPresenter() {
        return new PatrolConnectionAtPresenter(this);
    }
}
